#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os

for dirpath, _, filenames in os.walk('.'):
  for filename in filenames:
    if filename.startswith('BEE'):
        oldFile = os.path.join(dirpath, filename)
        newFile = os.path.join(dirpath, filename.replace('BEE', 'QS', 3))
        print newFile
        inFile = open(oldFile)
        outFile = open(newFile, 'w')
        replacements = {'BEE':'QS'}
        for line in inFile:
            for src, target in replacements.iteritems():
                line = line.replace(src, target)
            outFile.write(line)
        inFile.close()
        outFile.close()
        os.remove(oldFile) 